package internal

import (
	"bootstrap"
	. "game_server/internal"
	"os"
	"path/filepath"
)

type testApi struct {
}

var Test = new(testApi)

func (api *testApi) Init() (result *Module, err error) {
	var curPath string
	if curPath, err = os.Getwd(); err != nil {
		return
	}

	rootPath := filepath.Join(curPath, "..", "..", "..", "..")
	configFile := filepath.Join(rootPath, "bin", "game_server.json")
	Config.Parse(configFile)

	args := new(bootstrap.StartArgs)
	args.Config = &Config.Bootstrap
	bootstrap.Start(args)

	result = new(Module)
	result.OnPrepare()
	result.OnInit()

	return
}
